package com.ww.gss.exceptionhandler;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ww.gss.exceptions.BusinessException;
import com.ww.gss.util.GSSWebUtil;
import com.ww.gss.util.SystemConstans;

@ControllerAdvice
public class ControllerExceptionHandler {
	@ExceptionHandler(BusinessException.class)
	// @ResponseStatus(HttpStatus.BAD_REQUEST)
	public @ResponseBody Map handleSQLException(HttpServletRequest request, Exception ex) {
		return GSSWebUtil.buildResponseMap(SystemConstans.RESPONSE_LABEL_ERROR, null, SystemConstans.SYSTEM_ERROR);
	}
}
